/*    */ package com.zimbra.cs.client.soap;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.soap.DomUtil;
/*    */ import com.zimbra.common.soap.MailConstants;
/*    */ import java.util.Iterator;
/*    */ import org.dom4j.DocumentHelper;
/*    */ import org.dom4j.Element;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class LmcCheckSpellingRequest
/*    */   extends LmcSoapRequest
/*    */ {
/*    */   private String mText;
/*    */   
/*    */   public LmcCheckSpellingRequest(String text)
/*    */   {
/* 35 */     this.mText = text;
/*    */   }
/*    */   
/*    */   public String getText() {
/* 39 */     return this.mText;
/*    */   }
/*    */   
/*    */   protected Element getRequestXML() {
/* 43 */     Element request = DocumentHelper.createElement(MailConstants.CHECK_SPELLING_REQUEST);
/* 44 */     request.addText(this.mText);
/* 45 */     return request;
/*    */   }
/*    */   
/*    */   protected LmcSoapResponse parseResponseXML(Element responseXML)
/*    */     throws ServiceException
/*    */   {
/* 51 */     boolean isAvailable = DomUtil.getAttrBoolean(responseXML, "available");
/* 52 */     LmcCheckSpellingResponse response = new LmcCheckSpellingResponse(isAvailable);
/*    */     
/* 54 */     Iterator i = responseXML.elementIterator();
/* 55 */     while (i.hasNext()) {
/* 56 */       Element misspelled = (Element)i.next();
/* 57 */       String word = DomUtil.getAttr(misspelled, "word");
/* 58 */       String suggestions = DomUtil.getAttr(misspelled, "suggestions");
/* 59 */       response.addMisspelled(word, suggestions.split(","));
/*    */     }
/*    */     
/* 62 */     return response;
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/client/soap/LmcCheckSpellingRequest.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */